<template>
    <div class="home_meager">
        <el-form :model="form" label-width="120px">
            <el-form-item label="请输入首页描述">
                <el-input
                    v-model="form.abstract"
                    placeholder="请输入用户名"
                    type="textarea"
                    :autosize="{ minRows: 4, maxRows: 8 }"
                />
            </el-form-item>
            <el-form-item label="请上传首页图片">
                <el-upload
                    v-model="form.homeUrl"
                    action="http://49.232.206.229:7001/api/home/imgupload"
                    :on-success="fileSuccess"
                >
                    <el-button type="primary">上传图片</el-button>
                </el-upload>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">确定</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script setup lang="ts">
import { reactive } from 'vue';
import { homeEdit } from '@/api/home';
const form = reactive({
    abstract: '',
    homeUrl: '',
});
const onSubmit = () => {
    console.log('form', form);
    homeEdit(form).then((res: object) => {
        console.log('上传red', res);
    });
};
const fileSuccess = (response: any) => {
    console.log(response);
    const { code, data } = response;
    if (code === 0) {
        form.homeUrl = data;
    }
};
</script>
<style lang="scss" scoped>
.home_meager {
    overflow: hidden;
    background-color: #fff;
    padding: 20px;
}
</style>
